package org.shunfeng.service.impl;

import org.shunfeng.dao.UserDao;
import org.shunfeng.dao.impl.UserDaoImpl;
import org.shunfeng.pojo.SysUser;
import org.shunfeng.service.UserService;
import org.shunfeng.utils.MD5Utils;

import java.sql.SQLException;

public class UserServiceImpl implements UserService {
    private UserDao userDao = new UserDaoImpl();

    @Override
    public SysUser login(String username, String password) throws SQLException {
        String encrypt = MD5Utils.encrypt(password);
        return userDao.login(username, encrypt);
    }
    @Override
    public SysUser confirmPassword(String uId, String password) throws SQLException {
        return userDao.confirmPassword(uId, MD5Utils.encrypt(password));
    }
    @Override
    public int updatePassword(String Uid, String password) throws SQLException {
        return userDao.updatePassword(Uid, MD5Utils.encrypt(password));
    }
}
